home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0399 / 306 < prev    next >
Internet Message Format  |  1994-08-27  |  1KB

  1. Date: Sat, 12 Jun 93 12:01:01 -0400
  2. From: dsb@cs.duke.edu (Scott Bigham)
  3. Message-Id: <9306121601.AA23201@amazon.cs.duke.edu>
  4. To: mint@terminator.rs.itd.umich.edu
  5. Subject: Bus error -- core dumped
  6.  
  7. Hello all.  For my first question to the list, I submit the following:
  8. -----------
  9. #include <signal.h>
  10. #include <stdio.h>
  11.  
  12. void panic(n) int n; {fprintf(stderr, "Received signal %d\n", n); exit(1);}
  13.  
  14. main()
  15. {
  16. char c, *p=0; __Sigfunc l;
  17.   l=signal(SIGBUS, panic);            /* catch bus errors */
  18.   fprintf(stderr, "%lu\n", (unsigned long)l);
  19.   c=*p;                        /* force a bus error */
  20. }
  21. -----------
  22. which, when compiled with HSC and the MiNTlibs pl30 and run under MiNT
  23. 0.95, yields:
  24. -----------
  25. 0
  26. pid 41 (hmm): BUS ERROR: User PC=0 (basepage=14f670)
  27. Bus error
  28. -----------
  29. to my great surprise (particularly when cpp started crashing with files
  30. open -- so much for that partition).
  31.  
  32. If I replace the offending line with a raise(SIGBUS), all works as
  33. expected.  Also, I can catch SIGINT and SIGQUIT with no problems.
  34.  
  35. Now, the signal dispatch table is (I assume) part of the process's state
  36. information, and MiNT knows which process died, so it should have enough
  37. information to invoke my signal handler.  So why doesn't it?
  38.  
  39.                         -sbigham
  40.